<%-- 
    Document   : addFriend
    Created on : May 29, 2011, 11:42:52 AM
    Author     : Kevin
--%>

<%@page contentType="text/html" import="com.movie.*" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<%@include file="headerv.html"%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h1>UserInfo</h1>
        <% Viewer v = (Viewer) request.getAttribute("friend");            %>

        <table>
            <tr>
                <td>name:</td>
                <td><%= v.getFirstname()%>&nbsp;<%= v.getLastname()%></td>
            </tr>
            <tr>
                <td>Birthday:</td>
                <td> <% if (v.getYearofbirthpublic() == true) {                        %>
                    <%= v.getYearofbirth()%>
                    <%} else%> Information is not open to public.<%;%>
                </td>
            </tr>
            <tr>
                <td>Email:</td>
                <td> <% if (v.getEmailpublic() == true) {                    %>
                    <%= v.getEmail()%>
                    <%} else%> Information is not open to public.<%;%>
                </td>
            </tr>
            <tr>
                <td>Facourite genres:</td>
                <td> <% Set genreSet = v.getGenres();
                    Iterator i1 = genreSet.iterator();
                    while (i1.hasNext()) {
                        Genre g = (Genre) i1.next();
                    %><%= g.getName()%>&nbsp;
                    <%}%>
                </td>
            </tr>
            <tr>
                <td>Facourite acotrs:</td>
                <td> <% Set actorSet = v.getActors();
                    Iterator i2 = actorSet.iterator();
                    while (i2.hasNext()) {
                        Actor a = (Actor) i2.next();
                    %><%= a.getFirstname()%>&nbsp;<%= a.getLastname()%>&nbsp;
                    <%}%>
                </td>
            </tr>
            <% session.setAttribute("friend", v); %>
            <% if(request.getAttribute("isfriend").equals("false")) {%>
            <tr>
                <td>Self introduction:</td>
                <td>   
                    <form action="dispatcher?operation=friendadd" method="post">
                        <textarea name="introduction" rows="15" cols="40" ></textarea>
                        <br><input type="submit" value="send request">
                        </form>
                </td>
            </tr>
            <%}%>
            <% if(request.getAttribute("isfriend").equals("true")) {%>
            <tr>
                <td>He/She is already in your friendlist.</td>
                <td>   
                </td>
            </tr>
            <%}%>
        </table>

    </body>
</html>
<%@include file="footer.html"%>